package fun.coding.leetcode;


public class MaximumDepthOfBinaryTree {

    /**
     * @param args
     */
    public static void main(String[] args) {

    }
    
    // Recursion is very simple, just calculate the max of the left and right and then +1. 
    public int maxDepth(TreeNode root) {
       if (root == null) {
           return 0;
       } 
       
       return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;
    }
    
    // http://leetcode.com/2010/04/maximum-height-of-binary-tree.html
    // trick part is how to do it iteratively
    // One quick way is to do a level order traversal, and return List<List<Integer>>, then the List.size is the answer. 

}
